﻿
@using KRM.Core.Library
@model List<KRM.Core.vTriggerDetail>

@if (Users.Current(User.Identity.Name) == null)
{
    Response.Redirect("/users");
}

<div class="row-fluid">
    @if (Model.Any())
    {
        <table class="table table-hover table-bordered table-fix">
            <thead>
                <tr>
                    <th>Run type</th>
                    <th>Detail</th>
                    <th>Next run</th>
                    <th>Enable</th>
                    <th>Delete</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>@item.RunTypeName</td>
                        <td><a href="/scenario/edittrigger/@item.TriggerID">@item.Detail</a></td>
                        <td>@item.NextRun</td>
                        <td><a href="javascript:;" onclick="enableTrigger(@item.TriggerID, @item.TaskID);">@(item.Enable == true ? "Disable" : "Enable")</a></td>
                        <td><a href="javascript:;" onclick="deleteTrigger(@item.TriggerID, @item.TaskID);">Delete</a></td>
                    </tr>
                }
            </tbody>
        </table>
            
    }
    else
    {
        <p style="text-align: center">No trigger!</p>
    }
</div>




